{% extends "layout.html" %}

{% block content %}
<div>
    <div class="container">
        <div style="margin: 10px">
            <a class="btn btn-success" href="/depart/add" target="_blank"> {# blank表示在新页面打开#}
                <i class="bi bi-plus-circle-fill"></i>
                添加部门
            </a>
        </div>
        <ul class="list-group">
            <li class="list-group-item list-group-item-dark">
                <i class="bi bi-calendar2-event-fill"></i>
                <strong>部门列表</strong>
            </li>
            <li class="list-group-item">
                <table class="table">
                      <thead>
                        <tr>
                          <th scope="col">ID</th>
                          <th scope="col">名称</th>
                          <th scope="col">操作</th>
                        </tr>
                      </thead>
                      <tbody>
                      {% for obj in queryset %}
                        <tr>
                          <th scope="row">{{ obj.department_id }}</th>
                          <td>{{ obj.title}}</td>
                          <td>
                              <a class="btn btn-primary btn-sm" href="/depart/{{ obj.department_id }}/edit">编辑</a>
                              <a class="btn btn-danger btn-sm" href="/depart/delete/?nid={{ obj.department_id }}">删除</a>
                          </td>
                        </tr>
                      {% endfor %}
                      </tbody>
                    </table>
            </li>
        </ul>
    </div>

</div>
{% endblock %}